<!DOCTYPE html>
<html lang="en" ng-app="AldeasInfantiles">
<head>
  <title>Aldeas Infantiles | Administrar Inventario</title>
  <?php
	  $this->load->view('head_view');
  ?>
  <script src="<?php echo base_url("assets/js/inventory-view.js"); ?>"></script>
  <script src="<?php echo base_url("assets/js/angular-file-upload.js"); ?>"></script>
  <script src="<?php echo base_url("assets/js/menu-view.js"); ?>"></script>
  <script src="<?php echo base_url("assets/js/bootstrap-datepicker.js"); ?>"></script>
  <script src="<?php echo base_url("assets/js/bootstrap-datepicker.es.js"); ?>"></script>
  <link href="<?php echo base_url("assets/css/datepicker3.css"); ?>" rel="stylesheet">
</head>
<body>
  <div class="container">
    <div class="masthead">
      <?php
        $this->load->view('nav_view');
      ?>
    </div>
    <div class="jumbotron" ng-controller="Inventory">
        


        <div class="panel-group" id="accordion">
           <div class="panel panel-primary">
           
                <div class="panel-heading">
                    <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion" href="#accordionOne">
                      Editar Inventario
                    </a>
                   </h4>
                </div>
            
                <div id="accordionOne" class="panel-collapse collapse in">
                  <div class="panel-body">
                    <form class="form-horizontal" role="form" id="form-edit-article" >
                      <h4>Editar Articulos <span class="glyphicon glyphicon-asterisk"></span></h4>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="add-article-search" class="col-sm-12 control-label">Buscar:</label>
                        </div>
                        <div class="col-xs-8">
                          <a href="#" data-toggle="modal" data-target="#modal-articles" ng-click="showArticles()"><span class="glyphicon glyphicon-search"></span> Buscar</a>
                        </div>
                      </div>
                      <div class="row hide">
                        <div class="col-xs-4">
                          <label for="article.articleid" class="col-sm-12 control-label">Identificador:</label>
                        </div>
                        <div class="col-xs-8">
                          <input type="text" class="form-control" ng-model="article.articleid" id="article.articleid" name="articleid" disabled>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.serial" class="col-sm-12 control-label">Serie:</label>
                        </div>
                        <div class="col-xs-8">
                          <input type="text" class="form-control" ng-model="article.serial" id="article.serial" name="article.serial" placeholder="Serie" title="Escriba el n&uacute;mero de serie" >
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.model" class="col-sm-12 control-label">Modelo:</label>
                        </div>
                        <div class="col-xs-8">
                          <input type="text" class="form-control" ng-model="article.model" id="article.model" name="article.model" placeholder="Modelo" title="Escriba el modelo" >
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.plate" class="col-sm-12 control-label">Placa:</label>
                        </div>
                        <div class="col-xs-8">
                          <input type="text" class="form-control" ng-model="article.plate" id="article.plate" name="article.plate" placeholder="Placa" title="Escriba la placa" >
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="selectedtype" class="col-sm-12 control-label">Tipo:</label>
                        </div>
                        <div class="col-xs-8">
                          <select id="selectedtype" name="selectedtype" class="form-control" title="Seleccione tipo de art&iacute;culo" 
                            ng-model="selectedtype"
                            ng-options="type.id_articulo as type.ds_articulo for type in articlesTypes">
                          </select>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="selectedCountry" class="col-sm-12 control-label">Pa&iacute;s</label>
                        </div>
                        <div class="col-xs-8">
                          <select id="selectedCountry" name="selectedCountry" class="form-control" title="Seleccione el pa&iacute;s del art&iacute;culo" ng-change="requestDorps()"
                            ng-model="selectedCountry"
                            ng-options="country.id_pais as country.ds_pais for country in countries"
                            >
                          </select>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="selectedDorp" class="col-sm-12 control-label">Programa:</label>
                        </div>
                        <div class="col-xs-8">
                          <select id="selectedDorp" name="selectedDorp" class="form-control" title="Seleccione el programa del art&iacute;culo" ng-change="requestHouses()"
                            ng-model="selectedDorp"
                            ng-options="dorp.id_programa as dorp.ds_programa for dorp in dorps"
                            >
                          </select>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="selectedHouse" class="col-sm-12 control-label">Ubicaci&oacute;n:</label>
                        </div>
                        <div class="col-xs-8">
                          <select id="selectedHouse" name="selectedHouse" class="form-control" title="Seleccione la ubicaci&oacute;n del art&iacute;culo"
                            ng-model="selectedHouse"
                            ng-options="casa.id_casa as casa.ds_casa for casa in houses"
                            >
                          </select>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="selectedStatus" class="col-sm-12 control-label">Estado:</label>
                        </div>
                        <div class="col-xs-8">
                          <select id="selectedStatus" name="selectedStatus" class="form-control" title="Seleccione el estado del art&iacute;culo"
                            ng-model="selectedStatus"
                            ng-options="status.id_estado as status.ds_estado for status in statuses"
                            >
                          </select>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.description" class="col-sm-12 control-label">Descripción:</label>
                        </div>
                        <div class="col-xs-8">
                          <textarea rows="2" cols="30" class="form-control ng-pristine ng-valid" ng-model="article.description" id="article.description" name="description" title="Escriba la descripción del artículo">                          </textarea>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.features" class="col-sm-12 control-label">Características:</label>
                        </div>
                        <div class="col-xs-8">
                          <textarea rows="2" cols="30" class="form-control ng-pristine ng-valid" ng-model="article.features" id="article.features" name="features" title="Escriba las características del artículo">                          </textarea>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.comments" class="col-sm-12 control-label">Comentarios:</label>
                        </div>
                        <div class="col-xs-8">
                          <textarea rows="2" cols="30" class="form-control ng-pristine ng-valid" ng-model="article.comments" id="article.comments" name="comments" title="Escriba los comentarios del artículo">                          </textarea>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.dataenter" class="col-sm-12 control-label">Ingreso:</label>
                        </div>
                        <div class="col-xs-8">
                          <div class="input-group date">
                            <input type="text" class="form-control" ng-model="article.dataenter" id="article.dataenter" name="article.dataenter" title="Escriba la fecha de ingreso">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                          </div>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.use" class="col-sm-12 control-label">Vida &Uacute;til</label>
                        </div>
                        <div class="col-xs-8">
                          <div class="input-group date">
                            <input type="text" class="form-control" ng-model="article.use" id="article.use" name="article.use" title="Escriba la vida &uacute;til">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                          </div>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.donation" class="col-sm-2 control-label">Donación:</label>
                        </div>
                        <div class="col-xs-8">
                          <input type="checkbox" class="form-control" ng-model="article.donation" id="article.donation" name="article.donation" value="Donación" checked="">
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="article.dsResponsible" class="col-sm-12 control-label">Responsable:</label>
                        </div>
                        <div class="col-xs-6">
                          <input type="text" class="form-control" ng-model="article.dsResponsible" id="article.dsResponsible" name="article.dsResponsible" placeholder="Responsable" title="Nombre del responsable" readonly>
                        </div>
                        <div class="col-xs-2">
                          <a href="#" data-toggle="modal" data-target="#modal-responsibles" ng-click="showResponsibles()"><span class="glyphicon glyphicon-search"></span> Buscar</a>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="selectedClassification" class="col-sm-2 control-label">Clasificaci&oacute;n:</label>
                        </div>
                        <div class="col-xs-8">
                          <select class="form-control" ng-model="selectedClassification" id="selectedClassification" name="selectedClassification" title="Seleccione la clasificaci&oacute;n">
                            <option value="0">Valor Alto</option>
                            <option value="1">Valor Bajo</option>
                          </select>
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="imagefile" class="col-sm-2 control-label">Im&aacute;gen:</label>
                        </div>
                        <div class="col-xs-8">
                          <input class="form-control" id="file" name="file" type="file" file="file" accept="image/*" required />
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="imagefile" class="col-sm-12 control-label">Thumbnail:</label>
                        </div>
                        <div class="col-xs-8">
                          <img ng-if="prev_img" src="{{prev_img}}" class="img-thumbnail" width="140px" height="140px">
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-8">

                        </div>
                        <div class="col-xs-4">
                          <input type="reset" class="btn btn-default" value="Cancelar"  />
                          <input type="submit" class="btn btn-primary" value="Guardar" ng-click="saveArticle(article)"/>
                        </div>
                      </div>
                  </form>
                  </div>
                </div>
          </div>
          
           <div class="panel panel-primary">
            
                  <div class="panel-heading">
                  <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion" href="#accordionTwo">
                      Carga Masiva de Datos
                    </a>
                  </h4>
                  </div>
             
                <div id="accordionTwo" class="panel-collapse collapse">
                  <div class="panel-body">
                    <form class="form-horizontal" role="form" id="form-edit-article-type">
                      <h4>Carga Masiva de Art&iacute;culos desde un archivo Excel <span class="glyphicon glyphicon-list-alt"></span></h4>
                      <div class="row">
                        <div class="col-xs-4">
                          <label for="file" class="col-sm-12 control-label">Archivo:</label>
                        </div>
                        <div class="col-xs-8">
                          <input class="form-control" id="file" name="file" type="file" file="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" required />
                        </div>
                      </div>
                      <div class="row">
                        <div class="col-xs-8">
                        </div>
                        <div class="col-xs-4">
                          <input type="reset" class="btn btn-default" value="Cancelar"  />
                          <input type="submit" class="btn btn-primary" value="Cargar" ng-click="loadFile()" />
                        </div>
                      </div>
                  </form>
                  </div>
                </div>
            
           </div>
            <div id="messages-users" class="alert alert-dismissable {{alertClass}} {{hiddenClass}}">
              <strong>Mensaje!</strong> <span id="message-text">{{errorMessage}}</span>
            </div>
         </div>
        <div class="modal fade" id="modal-responsibles" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <h4 class="modal-title">Seleccione el responsable</h4>
              </div>
                  <div class="modal-body">
              <form class="form-horizontal" role="form" id="user-form">
                <div class="row">
                  <div class="col-xs-2">
                    <h5>Filtrar:</h5>
                  </div>
                  <div class="col-xs-4">
                    <input type="text" class="form-control" placeholder="Nombre del responsable" ng-model="query" id="userfilter" name="userfilter" value="" size="25" />
                  </div>
                </div>
                <div class="list-group" role="navigation">
                  <a ng-repeat="resposible in resposibles | filter:query" ng-click="getResposibleById(resposible, $event)" href="" class="list-group-item">{{resposible.ds_nombre}}</a>
                </div>
              </form>
                  </div>
                </div><!-- /.modal-content -->
              </div><!-- /.modal-dialog -->
          </div>
    </div>
    <?php
      $this->load->view('footer_view');
    ?>
  </div>
</body>
</html>